<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>click模仿dbclick</title>
</head>
<body>
    <h1>双击弹出窗口</h1>
    <script>
        var h1 = document.querySelector("h1"),
            hit = 0;
        h1.addEventListener("click",function(){
            hit++;
            // console.log(hit);
            setTimeout(() => {
                    hit = 0;
                }, 300);
            if(hit==2){
                alert("双击成功");
                setTimeout(() => {
                    hit = 0;
                }, 200);
            }
        } )
    </script>
</body>
</html>